﻿using System.Text;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Data;
using System.Windows.Documents;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Imaging;
using System.Windows.Navigation;
using System.Windows.Shapes;
using Microsoft.Win32;

namespace WpfApp1;

/// <summary>
/// Interaction logic for MainWindow.xaml
/// </summary>
public partial class MainWindow : Window
{
    public MainWindow()
    {
        InitializeComponent();
    }


    private void Msg1(object sender, RoutedEventArgs e)
    {
        MessageBox.Show("hello");
    }
    private void Msg2(object sender, RoutedEventArgs e)
    {
        MessageBox.Show("hello","title");
    }
    private void Msg3(object sender, RoutedEventArgs e)
    {
        MessageBoxResult btn =MessageBox.Show("hello","title", MessageBoxButton.YesNo);
        if (btn == MessageBoxResult.Yes)
        {
            MessageBox.Show("yes");
        }
        else
        {
            MessageBox.Show("no");
        }
    }

    private void Openfile(object sender, RoutedEventArgs e)
    {
        OpenFileDialog w = new OpenFileDialog();
        w.ShowDialog();
        MessageBox.Show(w.FileName);
    }
    
    private void OpenWindow(object sender, RoutedEventArgs e)
    {
        Window w = new ComboBoxWindow();
        w.ShowDialog(); //使用ShowDialog确保只能打开一个窗口
    }

    private void OpenTextWindow(object sender, RoutedEventArgs e)
    {
        Window w = new TextWindow();
        w.ShowDialog();

    }

    private void OpenSpinWindow(object sender, RoutedEventArgs e)
    {
        Window w = new NumUpDownWindow();
        w.ShowDialog();
    }

    private void OpenMenuWindow(object sender, RoutedEventArgs e)
    {
        Window w = new MenuWindow();
        w.ShowDialog();

    }

    private void OpenDataGridWindow(object sender, RoutedEventArgs e)
    {
        Window w = new DataGridWindow();
        w.ShowDialog();

    }

    private void OpenPlotWindow(object sender, RoutedEventArgs e)
    {
        Window w = new PlotWindow();
        w.ShowDialog();
    }
}